----------------------------------------------------------------------------------------------------------------------------------
--[[

    

]]--
----------------------------------------------------------------------------------------------------------------------------------
local hutao_com_polearm_mastery = Class(function(self, inst)
    self.inst = inst


    self.classified = nil
    self.data = {}

end)
------------------------------------------------------------------------------------------------------------------------------
--- classified
    function hutao_com_polearm_mastery:AttachClassified(classified)
        self.classified = classified
        classified:ListenForEvent("polearm_mastery_com_update",function()
            self.inst:PushEvent("hutao_com_polearm_mastery_update")
        end)
        classified:ListenForEvent("hutao_classified_polearm_mastery_data",function()
            self.data = classified:GetPolearmMasteryData()
            self.inst:PushEvent("hutao_classified_polearm_mastery_data")
        end)
        self.data = classified:GetPolearmMasteryData()        
        print("hutao_com_polearm_mastery:AttachClassified")
    end
------------------------------------------------------------------------------------------------------------------------------
-- table 数据同步
    function hutao_com_polearm_mastery:SetData(_table)
        if self.classified then
            self.classified:SetPolearmMasteryData(_table)
        end
    end
    function hutao_com_polearm_mastery:GetData()
        if self.classified then
            self.classified:GetPolearmMasteryData()
        end
        return self.data
    end
------------------------------------------------------------------------------------------------------------------------------
-- weapon
    function hutao_com_polearm_mastery:IsSpikeWeapon(prefab)
        if self.data and self.data.spike_weapons and self.data.spike_weapons[prefab] then
            return true
        end
        return false
    end
------------------------------------------------------------------------------------------------------------------------------
-- is_running
    function hutao_com_polearm_mastery:IsRunning()
        return self.data.is_running or false
    end
------------------------------------------------------------------------------------------------------------------------------
-- 充能值
    function hutao_com_polearm_mastery:SetCurrent(value)
        if self.classified then
            self.classified:SetPolearmMastery(value)
        end
    end
    function hutao_com_polearm_mastery:GetCurrent()
        if self.classified then
            return self.classified:GetPolearmMastery()
        end
        return 0
    end
    function hutao_com_polearm_mastery:SetMax(value)
        if self.classified then
            self.classified:SetPolearmMasteryMax(value)
        end
    end
    function hutao_com_polearm_mastery:GetMax()
        if self.classified then
            return self.classified:GetPolearmMasteryMax()
        end
        return 1
    end
------------------------------------------------------------------------------------------------------------------------------
return hutao_com_polearm_mastery







